package com.snail.controller;

import com.snail.model.entity.User;
import com.snail.model.entity.Work;
import com.snail.model.pojo.SearchHitResult;
import com.snail.service.BizWorkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @author cici
 * @description 搜索作品
 * @date 2025/8/19 14:04
 */
@RequestMapping("/searchWorks")
@RestController
public class BizWorkController {
    @Autowired
    private BizWorkService bizWorkService;

    @GetMapping("/work")
    public ResponseEntity<?> searchWorkByES(@RequestParam String keyword, @RequestParam int page, @RequestParam int size) {
        SearchHitResult<Work> response = bizWorkService.SearchAsHot(keyword,page,size);
        SearchHitResult<Work> resp = bizWorkService.searchAndSerialize(keyword,page,size);
        return ResponseEntity.ok(resp);
    }

}
